package com.ruoyi.business.service.impl;

import com.ruoyi.business.domain.TenantComponentReturnValueVersion;
import com.ruoyi.business.mapper.TenantComponentReturnValueVersionMapper;
import com.ruoyi.business.service.ITenantComponentReturnValueVersionService;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 租户复合组件返回值Service业务层处理
 *
 * @author ruoyi
 * @date 2025-11-18
 */
@Service
public class TenantComponentReturnValueVersionServiceImpl implements ITenantComponentReturnValueVersionService
{
    @Autowired
    private TenantComponentReturnValueVersionMapper tenantComponentReturnValueVersionMapper;

    /**
     * 查询租户复合组件返回值
     *
     * @param id 租户复合组件返回值主键
     * @return 租户复合组件返回值
     */
    @Override
    public TenantComponentReturnValueVersion selectTenantComponentReturnValueVersionById(Long id)
    {
        return tenantComponentReturnValueVersionMapper.selectTenantComponentReturnValueVersionById(id);
    }

    /**
     * 查询租户复合组件返回值列表
     *
     * @param tenantComponentReturnValueVersion 租户复合组件返回值
     * @return 租户复合组件返回值
     */
    @Override
    public List<TenantComponentReturnValueVersion> selectTenantComponentReturnValueVersionList(TenantComponentReturnValueVersion tenantComponentReturnValueVersion)
    {
        return tenantComponentReturnValueVersionMapper.selectTenantComponentReturnValueVersionList(tenantComponentReturnValueVersion);
    }

    /**
     * 新增租户复合组件返回值
     *
     * @param tenantComponentReturnValueVersion 租户复合组件返回值
     * @return 结果
     */
    @Override
    public int insertTenantComponentReturnValueVersion(TenantComponentReturnValueVersion tenantComponentReturnValueVersion)
    {
        tenantComponentReturnValueVersion.setCreateTime(DateUtils.getNowDate());
        return tenantComponentReturnValueVersionMapper.insertTenantComponentReturnValueVersion(tenantComponentReturnValueVersion);
    }

    /**
     * 修改租户复合组件返回值
     *
     * @param tenantComponentReturnValueVersion 租户复合组件返回值
     * @return 结果
     */
    @Override
    public int updateTenantComponentReturnValueVersion(TenantComponentReturnValueVersion tenantComponentReturnValueVersion)
    {
        tenantComponentReturnValueVersion.setUpdateTime(DateUtils.getNowDate());
        return tenantComponentReturnValueVersionMapper.updateTenantComponentReturnValueVersion(tenantComponentReturnValueVersion);
    }

    /**
     * 批量删除租户复合组件返回值
     *
     * @param ids 需要删除的租户复合组件返回值主键
     * @return 结果
     */
    @Override
    public int deleteTenantComponentReturnValueVersionByIds(Long[] ids)
    {
        return tenantComponentReturnValueVersionMapper.deleteTenantComponentReturnValueVersionByIds(ids);
    }

    /**
     * 删除租户复合组件返回值信息
     *
     * @param id 租户复合组件返回值主键
     * @return 结果
     */
    @Override
    public int deleteTenantComponentReturnValueVersionById(Long id)
    {
        return tenantComponentReturnValueVersionMapper.deleteTenantComponentReturnValueVersionById(id);
    }

    /**
     * 根据组件key删除返回值列表
     *
     * @param componentKey   组件key
     * @param enterpriseCode 企业编码
     * @param version        版本
     * @return
     */
    @Override
    public int deleteReturnValueVersionByComponentKey(String componentKey, String enterpriseCode, Integer version) {
        return tenantComponentReturnValueVersionMapper.deleteReturnValueVersionByComponentKey(componentKey, enterpriseCode, version);
    }
}
